<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="uct" uri="/WEB-INF/uct.tld" %>
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <%@ include file="/common/scooter/include/common-base.jsp"%>
    <title>前端登录小窗口</title>
	  <script src="${ctx}/js/jquery-tools.min.js"></script>
	  <script src="${ctx}/js/jquery-md5-min.js"></script>
	  <script src="${ctx}/js/uct/uc.js"></script>
  </head>

<script>
   $(function(){
		document.onkeydown = function(e){
			var ev = document.all ? window.event : e;
			if(ev.keyCode==13) {//回车事件
				   checklogin();//处理事件
			 }
		};
		$("#username").focus();
	});
	function checklogin(){
			if($("#username").val()==""){
				layer.tips('输入用户名', '#username', {tips: 1});
				$("#username").focus();
				return;
			}
			if($("#password").val()==""){
				layer.tips('输入密码', '#password', {tips: 1});
				$("#password").focus();
				return;
			}
			if($("#rand").val()==""){
				layer.tips('输入验证码', '#rand', {tips: 1});
				$("#rand").focus();
				return;
			}
			layer.msg("正在登录中...");
			$("#userEname").val($("#username").val());
			$("#userPwd").val($("#password").val().md5());
			$("#validatorCode").val($("#rand").val());
			var formUrl =ctx+"/res/uct/login";
			var result = $.platform.submit({formId:'myForm',dataType:'json',url:formUrl});
			//alert(result);
			opDone(result.flag,result.msg);
	}
	function opDone(flag,msg){
		if(flag=="T"){
			parent.location.href=ctx+"/res/uct/toIndex?go="+parent.location.href;
		}else{
		    layer.msg(msg);
		    layer.msg(msg, {
		    	  time: 5000//5s后自动关闭
		    	});
		}
	}
	function logout(){
	   if(confirm('您确定工作已经保存，并退出该系统?')){
		   parent.location = ctx+'/logout';
	   }
	}
</script>
<body>
<c:if test="${empty loginUser }">
		<div class="container panel">
		  	<div class="panel-body">
		  	<form id="myForm" name="myForm">
		  		<input type="hidden" name="username" id="userEname" />
			   	<input type="hidden" name="password" id="userPwd" />
		  		<div class="form-group col-xs-12 col-sm-12 lh40">
		  			<div class="input-group">
		  				<label class="input-group-addon gray fb"><i class="fa fa-user "></i> 用户名：</label>
    					<input type="text" class="form-control" maxlength="50" id="username" style="height:48px;" placeholder="请输入登录用户名"/>
                	</div>
		  		</div>
		  		<div class="form-group col-xs-12 col-sm-12">
		  			<div class="input-group">
		  				<label class="input-group-addon gray fb"><i class="fa fa-key "></i> 密&nbsp;&nbsp;&nbsp;码：</label>
    					<input type="password" class="form-control" maxlength="50" id="password"  style="height:48px;" placeholder="请输入登录密码"/>
                	</div>
		  		</div>
		  		<div class="form-group col-xs-12 col-sm-12">
		  			<div class="input-group">
		  				<label class="input-group-addon gray fb"><i class="fa fa-pencil "></i> 验证码：</label>
    					<input type="text" class="form-control" maxlength="4" name="rand" id="rand" value="" style="height:48px;" placeholder="请输入验证码"/>
    					<input name="flagDiv" id="flagDiv" type="hidden" value="" />
    					<div class="input-group-addon" style="background-color:#fff;">
	    					<img border=0 id="verifyCode" src="" onclick="viewVerifyCode();" style="visibility:hidden;" align="absmiddle"/>
							<script>viewVerifyCode();</script>
	    				</div>
                	</div>
		  		</div>
		  		<div class="form-group col-xs-12 col-sm-12">
                		<div class="clearfix font-16 margin-b-15">
							<div class="pull-left ">
								<a class="fx17" href="javascript:parent.location.href='${ctx}/sendPage/${sysName}/web/reg/reg-index'" >免费注册</a>
							</div>
							<div class="pull-right hidden">
								<a class="fx2" href="javascript:parent.location.href='${ctx}/sendPage/${sysName}/web/reg'">忘记密码</a>
							</div>
						</div>
		  		</div>
		  		<div class="form-group col-xs-12 col-sm-12 text-center">
			  			<button class="btn btn-block btn-warning btn-lg"  type="button" onclick="checklogin();"> 立即登录 </button>
		  		</div>
		  	</form>
		  	</div>
		 </div>
</c:if>
<script>
	function aaa(){
	  var flagDiv = document.getElementById('flagDiv').value;
	  if(flagDiv!='flagDiv'){
		document.getElementById('flagDiv').value='flagDiv';
		document.getElementById('DIVhidden1').style.display='none';
		document.getElementById('DIVhidden2').style.display='block';
		viewVerifyCode();
		document.getElementById('flagDiv').value='';
	  }
   }
</script>
</body>
</html>
